#ifndef _SHM_MANAGER_H
#define _SHM_MANAGER_H	

#include <sys/types.h>
#include <sys/shm.h>
#include <pthread.h>
#include <unistd.h>

class ShmManager
{
public:
	ShmManager(int shmkey);
	~ShmManager();
	
	int Creat(size_t size);
	int ShmDT();
	int Remove();
	void * GetShm();
	int Lock();
	int UnLock();
	int TryLock();	
	//int LockTimeOut(const struct timespec *restrict abs_timeout);  
private:
	void * m_ps;
	int m_shmkey;
	int m_shmid;
	pthread_mutex_t  m_mutex; 
};

#endif
